/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package j2ee.impl;

import j2ee.EjbRelationType;
import j2ee.J2eePackage;
import j2ee.RelationshipsType;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Relationships Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link j2ee.impl.RelationshipsTypeImpl#getEjbRelation <em>Ejb Relation</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RelationshipsTypeImpl extends EObjectImpl implements RelationshipsType {
	/**
	 * The cached value of the '{@link #getEjbRelation() <em>Ejb Relation</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEjbRelation()
	 * @generated
	 * @ordered
	 */
	protected EList<EjbRelationType> ejbRelation;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected RelationshipsTypeImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return J2eePackage.Literals.RELATIONSHIPS_TYPE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<EjbRelationType> getEjbRelation() {
		if (ejbRelation == null) {
			ejbRelation = new EObjectContainmentEList<EjbRelationType>(EjbRelationType.class, this, J2eePackage.RELATIONSHIPS_TYPE__EJB_RELATION);
		}
		return ejbRelation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case J2eePackage.RELATIONSHIPS_TYPE__EJB_RELATION:
				return ((InternalEList<?>)getEjbRelation()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case J2eePackage.RELATIONSHIPS_TYPE__EJB_RELATION:
				return getEjbRelation();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case J2eePackage.RELATIONSHIPS_TYPE__EJB_RELATION:
				getEjbRelation().clear();
				getEjbRelation().addAll((Collection<? extends EjbRelationType>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case J2eePackage.RELATIONSHIPS_TYPE__EJB_RELATION:
				getEjbRelation().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case J2eePackage.RELATIONSHIPS_TYPE__EJB_RELATION:
				return ejbRelation != null && !ejbRelation.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //RelationshipsTypeImpl
